package umacis.lwuitcomponent.property.controller;

import java.util.Vector;

import com.sun.lwuit.Component;
import com.sun.lwuit.geom.Dimension;



public class ComponentPropertyController extends PropertyController {

	public ComponentPropertyController(Vector components, Vector parents) {
		name = "Component";
		propertyGetterSetter = new PropertyGetterSetter[15];
		int i = 0;
		propertyGetterSetter[i++] =  new PropertyGetterSetter("x position") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setX(parameters.integer);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.getX()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("y position") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setY(parameters.integer);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.getY()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("isVisible") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setVisible(parameters.boolean1);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.isVisible()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("width") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setWidth(parameters.integer);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.getWidth()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("height") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setHeight(parameters.integer);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.getHeight()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("preferredHeight") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setPreferredH(parameters.integer);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.getPreferredH()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("preferredWidth") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setPreferredW(parameters.integer);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.getPreferredW()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("isFocusable") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setFocusable(parameters.boolean1);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.isFocusable()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("scrollAnimationSpeed") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setScrollAnimationSpeed(parameters.integer);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.getScrollAnimationSpeed()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("isSmoothScrolling") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setSmoothScrolling(parameters.boolean1);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.isSmoothScrolling()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("isEnabled") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setEnabled(parameters.boolean1);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.isEnabled()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("handlesInput") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setHandlesInput(parameters.boolean1);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.handlesInput()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("isScrollVisible") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setIsScrollVisible(parameters.boolean1);	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.isScrollVisible()						);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("scrollHeight") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setScrollSize(new Dimension(cmp.getScrollDimension().getWidth(),parameters.integer));	}   
			public Parameters get(Component cmp) {	return new Parameters(	cmp.getScrollDimension().getHeight()					);} };
		propertyGetterSetter[i++] =  new PropertyGetterSetter("scrollWidth") {	
			public void set(Component cmp, Parameters parameters) {			cmp.setScrollSize(new Dimension(parameters.integer, cmp.getScrollDimension().getHeight()) ); }
			public Parameters get(Component cmp) {	return new Parameters(	cmp.getScrollDimension().getWidth()					);} };
			
	
	
		set(components, parents);
		new LabelPropertyController(components, parents);
		new ContainerPropertyController(components, parents);
		new TextAreaPropertyController(components, parents);
		new ListPropertyController(components, parents);
		parents.removeElement(this);
		

		
	}

}
